import { createSSRApp } from "vue";
import "@/assets/style.css";
import App from "./App.vue";
import Empty from "@/components/empty/empty.vue";
import Nav from "@/components/nav/nav.vue";
import LoadPage from "@/components/loadPage/loadPage.vue";
import LoadMore from "@/components/loadMore/loadMore.vue";

export function createApp() {
  const app = createSSRApp(App);
  app.component("Nav", Nav);
  app.component("Empty", Empty);
  app.component("LoadPage", LoadPage);
  app.component("LoadMore", LoadMore);
  app.config.globalProperties.$goUrl = (url) => {
    if (url.indexOf("/pages/") != -1 || url.indexOf("/subPackage/") != -1) {
      uni.navigateTo({
        url: url,
      });
    } else if (url == "back") {
      uni.navigateBack();
    }
  };
  return {
    app,
  };
}
